using UnityEngine;

public class WaterSplash : MonoBehaviour
{
	public GameObject water_splash_particles;

	private AudioSource splash_sound;

	private bool in_water;

	private void Start()
	{
		splash_sound = GetComponent<AudioSource>();
	}

	private void OnTriggerEnter(Collider other)
	{
		if (other.tag == "Player")
		{
			water_splash_particles.transform.rotation = other.transform.rotation;
			Transform transform = water_splash_particles.transform;
			Vector3 position = other.transform.position;
			float x = position.x - 1f;
			Vector3 position2 = base.transform.position;
			float y = position2.y;
			Vector3 position3 = other.transform.position;
			transform.position = new Vector3(x, y, position3.z + 3f);
			water_splash_particles.GetComponent<ParticleSystem>().Play();
			if (!in_water)
			{
				splash_sound.Play();
			}
			in_water = true;
		}
	}

	private void OnTriggerExit(Collider other)
	{
		if (other.tag == "Player")
		{
			in_water = false;
		}
	}
}
